With the advancement of the computer technology, different problems and demands in people's lives can be solved and satisfied, respectively, by running particular software on various intelligent apparatuses. However, after codes of software have been written, how to perform an overall test on the codes to ensure that the software can operate normally is a quite important issue.
Code coverage is a common measure in current software testing and it describes the proportion of the code that is tested and to which degree the code is tested. Generally speaking, if the content of the code is not complex, then usually the program writer can detect the code on his/her own or determine whether all sections in the code would be executed by inputting simple parameters; however, if the code is relatively complex or the number of functions forming the code is too large, then the program writer usually detects the proportion of the code that is executed and to which degree the code is executed using software which is capable of testing code coverage. Higher code coverage means that the code will be executed as expected and errors are less likely to be generated.
Plenty of testing software based on code coverage rate is available nowadays, and the code test mechanism of most of the testing software is to generate test benches continuously, and use the generated test benches one by one as input parameters of the code to run the code until the code coverage rate reaches an intended value. However, in such a testing mechanism, before the code coverage rate reaches the intended value, a quite large number of test benches may be generated and the operation of executing the code may be repeated for many times, and this is quite time-consuming and most of these generated test benches may have the same effect in improving the code coverage (i.e., using one test bench has the same effect as using several test benches in improving the code coverage).
Accordingly, an urgent need exists in the art to provide a code test mechanism, which can effectively reduce the number of test benches that are used to execute the codes, thereby reducing the software testing time needed for the code coverage rate to reach the intended value.